// Description: 描述
package xtime

import "time"

const (
	LayoutForDatetime = "2006-01-02 15:04:05"
	TimeLayout        = "2006-01-02 15:04:05"
	TimeLayout1       = "2006-01-02 15:04:05.000"
	TimeLayout2       = "20060102150405"
	DateLayout        = "2006-01-02"
)

// 当前的秒
func CurrentSeconds() int64 {
	return time.Now().Unix()
}

// 当前的微秒
func CurrentMicros() int64 {
	return time.Now().UnixNano() / int64(time.Microsecond)
}

// 当前的毫秒
func CurrentMillis() int64 {
	return time.Now().UnixNano() / int64(time.Millisecond)
}

func subAtZeroTime(f func() time.Time) time.Time {
	tm := f()
	return time.Date(tm.Year(), tm.Month(), tm.Day(), 0, 0, 0, 0, tm.Location())
}

func subAtEndTime(f func() time.Time) time.Time {
	tm := f()
	return time.Date(tm.Year(), tm.Month(), tm.Day(), 23, 59, 59, 0, tm.Location())
}
